import { computed, reactive, ref } from "vue";
import { tableColumnMap } from "../data";
export default function InitHook() {
  const activeKey = ref<string>("1");
  const pageStat = ref<Base.GeneraDataType>({
    1: 0,
    2: 0,
    3: 0,
    0: 0
  });
  const tableRef = ref<any>(null);
  const searchForm = reactive<WaterVerification.SearchForm>({
    companyIdList: [],
    beforePageNum: 0,
    chargeOffStateList: [],
    customerNames: "",
    accountIdList: [],
    createByList: [],
    approvalState: "",
    createName: "",
    proceedsTime: [],
    customerIdList: [],
    pageNum: 1,
    pageSize: 100,
    total: 0,
    billNum: "",
    orderNums: ""
  });
  const tableData = ref<Array<WaterVerification.ListRows>>([]);
  const drawerOpts = reactive<Base.DrawerOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  const dialogOpts = reactive<Base.DialogOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  const tableColumn = computed<Array<SuperTable.TableCoulmnItem | SuperTable.NestTableColumnItem>>(() => {
    return tableColumnMap[activeKey.value];
  });
  return {
    searchForm,
    tableData,
    drawerOpts,
    tableRef,
    dialogOpts,
    activeKey,
    pageStat,
    tableColumn
  };
}
